\(\int \cos (c+d x) (A+C \cos ^2(c+d x)) \, dx\) [4]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 30 \[ \int \cos (c+d x) \left (A+C \cos ^2(c+d x)\right ) \, dx=\frac {(A+C) \sin (c+d x)}{d}-\frac {C \sin ^3(c+d x)}{3 d} \]

[Out]

(A+C)*sin(d*x+c)/d-1/3*C*sin(d*x+c)^3/d

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.053, Rules used = {3092} \[ \int \cos (c+d x) \left (A+C \cos ^2(c+d x)\right ) \, dx=\frac {(A+C) \sin (c+d x)}{d}-\frac {C \sin ^3(c+d x)}{3 d} \]

[In]

Int[Cos[c + d*x]*(A + C*Cos[c + d*x]^2),x]

[Out]

((A + C)*Sin[c + d*x])/d - (C*Sin[c + d*x]^3)/(3*d)

Rule 3092

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((A_) + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Dist[-f^(-1), Subst[I
nt[(1 - x^2)^((m - 1)/2)*(A + C - C*x^2), x], x, Cos[e + f*x]], x] /; FreeQ[{e, f, A, C}, x] && IGtQ[(m + 1)/2
, 0]

Rubi steps \begin{align*} \text {integral}& = -\frac {\text {Subst}\left (\int \left (A+C-C x^2\right ) \, dx,x,-\sin (c+d x)\right )}{d} \\ & = \frac {(A+C) \sin (c+d x)}{d}-\frac {C \sin ^3(c+d x)}{3 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.67 \[ \int \cos (c+d x) \left (A+C \cos ^2(c+d x)\right ) \, dx=\frac {A \cos (d x) \sin (c)}{d}+\frac {A \cos (c) \sin (d x)}{d}+\frac {C \sin (c+d x)}{d}-\frac {C \sin ^3(c+d x)}{3 d} \]

[In]

Integrate[Cos[c + d*x]*(A + C*Cos[c + d*x]^2),x]

[Out]

(A*Cos[d*x]*Sin[c])/d + (A*Cos[c]*Sin[d*x])/d + (C*Sin[c + d*x])/d - (C*Sin[c + d*x]^3)/(3*d)

Maple [A] (verified)

Time = 2.50 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.03

method result size
parallelrisch \(\frac {\sin \left (3 d x +3 c \right ) C +12 \left (A +\frac {3 C}{4}\right ) \sin \left (d x +c \right )}{12 d}\) \(31\)
derivativedivides \(\frac {\frac {C \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+A \sin \left (d x +c \right )}{d}\) \(33\)
default \(\frac {\frac {C \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+A \sin \left (d x +c \right )}{d}\) \(33\)
parts \(\frac {\sin \left (d x +c \right ) A}{d}+\frac {C \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3 d}\) \(35\)
risch \(\frac {\sin \left (d x +c \right ) A}{d}+\frac {3 C \sin \left (d x +c \right )}{4 d}+\frac {\sin \left (3 d x +3 c \right ) C}{12 d}\) \(40\)
norman \(\frac {\frac {2 \left (A +C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {2 \left (A +C \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {4 \left (3 A +C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3}}\) \(75\)

[In]

int(cos(d*x+c)*(A+C*cos(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

1/12*(sin(3*d*x+3*c)*C+12*(A+3/4*C)*sin(d*x+c))/d

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 28, normalized size of antiderivative = 0.93 \[ \int \cos (c+d x) \left (A+C \cos ^2(c+d x)\right ) \, dx=\frac {{\left (C \cos \left (d x + c\right )^{2} + 3 \, A + 2 \, C\right )} \sin \left (d x + c\right )}{3 \, d} \]

[In]

integrate(cos(d*x+c)*(A+C*cos(d*x+c)^2),x, algorithm="fricas")

[Out]

1/3*(C*cos(d*x + c)^2 + 3*A + 2*C)*sin(d*x + c)/d

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 56 vs. \(2 (24) = 48\).

Time = 0.12 (sec) , antiderivative size = 56, normalized size of antiderivative = 1.87 \[ \int \cos (c+d x) \left (A+C \cos ^2(c+d x)\right ) \, dx=\begin {cases} \frac {A \sin {\left (c + d x \right )}}{d} + \frac {2 C \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {C \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (A + C \cos ^{2}{\left (c \right )}\right ) \cos {\left (c \right )} & \text {otherwise} \end {cases} \]

[In]

integrate(cos(d*x+c)*(A+C*cos(d*x+c)**2),x)

[Out]

Piecewise((A*sin(c + d*x)/d + 2*C*sin(c + d*x)**3/(3*d) + C*sin(c + d*x)*cos(c + d*x)**2/d, Ne(d, 0)), (x*(A +
 C*cos(c)**2)*cos(c), True))

Maxima [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 34, normalized size of antiderivative = 1.13 \[ \int \cos (c+d x) \left (A+C \cos ^2(c+d x)\right ) \, dx=-\frac {{\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} C - 3 \, A \sin \left (d x + c\right )}{3 \, d} \]

[In]

integrate(cos(d*x+c)*(A+C*cos(d*x+c)^2),x, algorithm="maxima")

[Out]

-1/3*((sin(d*x + c)^3 - 3*sin(d*x + c))*C - 3*A*sin(d*x + c))/d

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 34, normalized size of antiderivative = 1.13 \[ \int \cos (c+d x) \left (A+C \cos ^2(c+d x)\right ) \, dx=-\frac {{\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} C - 3 \, A \sin \left (d x + c\right )}{3 \, d} \]

[In]

integrate(cos(d*x+c)*(A+C*cos(d*x+c)^2),x, algorithm="giac")

[Out]

-1/3*((sin(d*x + c)^3 - 3*sin(d*x + c))*C - 3*A*sin(d*x + c))/d

Mupad [B] (verification not implemented)

Time = 0.05 (sec) , antiderivative size = 28, normalized size of antiderivative = 0.93 \[ \int \cos (c+d x) \left (A+C \cos ^2(c+d x)\right ) \, dx=-\frac {\frac {C\,{\sin \left (c+d\,x\right )}^3}{3}-\sin \left (c+d\,x\right )\,\left (A+C\right )}{d} \]

[In]

int(cos(c + d*x)*(A + C*cos(c + d*x)^2),x)

[Out]

-((C*sin(c + d*x)^3)/3 - sin(c + d*x)*(A + C))/d